'use strict';
module.exports = function (sequelize, DataTypes) {

  var TeamUser = sequelize.define('TeamUser', {
    id: {
      type: DataTypes.INTEGER.UNSIGNED,
      primaryKey: true,
      autoIncrement: true
    },
    teamId: {
      type: DataTypes.INTEGER.UNSIGNED,
      allowNull: false,
      validate: {
        isInt: true
      },
      comment: '分组ID'
    },
    userId: {
      type: DataTypes.INTEGER.UNSIGNED,
      allowNull: false,
      validate: {
        isInt: true
      },
      comment: '用户Id'
    },
    isMaster: {
      type: DataTypes.BOOLEAN,
      allowNull: false,
      defaultValue: false,
      comment: '时间戳（版本号）'
    },
    displayName: {
      type: DataTypes.STRING(41),
      comment: '用户在小组的显示名称'
    }
  }, {
    timstamps: true,
    paranoid: true,
    tableName: 'team_users'
  });

  return TeamUser;
};
